﻿using log4net;
using OF.Component.Model;
using System;
using System.Collections.Generic;
using System.Web.Http;

namespace LogCenter.Controllers
{
    /// <summary>
    /// 错误日志
    /// </summary>
    public class ErrorLogController : BaseController
    {
        //初始化自定义的日志类别 DataLogAdoAppenderLogger
        private ILog logger = LogManager.GetLogger("ErrorLogAdoAppenderLogger");
        /// <summary>
        ///  添加
        /// </summary>
        /// <param name="log"></param>
        [HttpPost, Route("ErrorLog")]
        public void Add(ErrorLogInfo log)
        {
            log.CreatedDate = DateTime.Now;
            logger.Info(log);
        }
        /// <summary>
        /// 暂未实现;获取列表
        /// </summary>
        [HttpGet, Route("ErrorLog")]
        public List<ErrorLogInfo> Get()
        {
            return new List<ErrorLogInfo>();
        }
        /// <summary>
        /// 暂未实现;根据ID取单条数据
        /// </summary>
        /// <param name="logId"></param>
        /// <returns></returns>
        [HttpGet, Route("ErrorLog/{logId}")]
        public ErrorLogInfo Get(long logId)
        {
            return new ErrorLogInfo();
        }
    }
}
